package com.lhkj.ct.meta.modules.gauge.model.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.lhkj.ct.base.enums.DeleteStatus;
import com.lhkj.ct.base.enums.GlobalStatus;
import com.lhkj.ct.base.mybatis.IBaseEntity;
import com.lhkj.ct.base.validator.group.ValGroups;
import com.lhkj.ct.meta.modules.gauge.common.enums.ChartType;
import com.lhkj.ct.meta.modules.gauge.common.enums.ConfigProcess;
import com.lhkj.ct.meta.modules.gauge.common.enums.ReportLayout;
import com.lhkj.ct.meta.modules.gauge.validation.ScaleGroupSequenceProvider;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.group.GroupSequenceProvider;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.PositiveOrZero;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Set;

/**
 * <p>
 *
 * </p>
 *
 * @author jobob
 * @since 2023-10-08
 */
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="TblScale对象", description="")
@GroupSequenceProvider(ScaleGroupSequenceProvider.class)
public class TblScale implements IBaseEntity<String> {

    private static final long serialVersionUID = 1L;

    @TableId
    @ApiModelProperty(value = "量表id")
    private String id;

    @NotBlank(message = "量表名称不能为空", groups = {ValGroups.Insert.class, ValGroups.Update.class})
    @Length(max = 50, message = "量表名称不能超过{max}字")
    @ApiModelProperty(value = "量表名称", required = true)
    private String scaleName;

    @NotBlank(message = "显示名称不能为空", groups = {ValGroups.Insert.class, ValGroups.Update.class})
    @Length(max = 50, message = "显示名称不能超过{max}字")
    @ApiModelProperty(value = "显示名称", required = true)
    private String displayName;

    @NotNull(message = "请选择是否推荐", groups = {ValGroups.Insert.class, ValGroups.Update.class})
    @ApiModelProperty(value = "是否推荐", required = true)
    private Boolean recommend;

    @NotBlank(message = "量表图片不能为空", groups = {recommend.class})
    @ApiModelProperty(value = "量表图片路径", notes = "如果推荐则必填")
    private String scalePicture;

    @NotNull(message = "请设置金额", groups = {recommend.class})
    @PositiveOrZero(message = "金额必须大于等于0", groups = {recommend.class})
    @ApiModelProperty(value = "金额", notes = "如果推荐则必填")
    private BigDecimal amount;

    @NotBlank(message = "量表介绍不能为空", groups = {ValGroups.Insert.class, ValGroups.Update.class})
    @Length(max = 50, message = "量表介绍不能超过{max}字")
    @ApiModelProperty(value = "量表介绍", required = true)
    private String introduction;

    @NotBlank(message = "指导语不能为空", groups = {ValGroups.Insert.class, ValGroups.Update.class})
    @Length(max = 50, message = "指导语不能超过{max}字")
    @ApiModelProperty(value = "指导语", required = true)
    private String instruction;

    @NotBlank(message = "请选择量表分类", groups = {ValGroups.Insert.class, ValGroups.Update.class})
    @ApiModelProperty(value = "量表分类")
    private String category;

    @ApiModelProperty(value = "适用人群")
    private String usability;

    @NotNull(message = "请选择报告排版", groups = {ValGroups.Insert.class, ValGroups.Update.class})
    @ApiModelProperty(value = "报告排版 1.常规 2.标准", required = true, example = "1")
    private ReportLayout layout;

    @ApiModelProperty(value = "统计图表类型")
    private ChartType chart;

    @ApiModelProperty(value = "状态 0.正常 1.禁用", example = "0")
    private GlobalStatus status;

    @NotNull(message = "排序不能为空", groups = {ValGroups.Insert.class, ValGroups.Update.class})
    @ApiModelProperty(value = "排序", required = true)
    private Integer sort;

    @ApiModelProperty(value = "是否系统内置 1.系统 2.自定义")
    private Integer type;

    @ApiModelProperty(value = "配置进度")
    private ConfigProcess progress;

    @ApiModelProperty(value = "题目json")
    private String questionJson;

    @TableField(fill = FieldFill.INSERT)
    @ApiModelProperty(value = "删除状态 0.未删除 1.已删除")
    private DeleteStatus delFlag;

    @TableField(fill = FieldFill.INSERT)
    @ApiModelProperty(value = "创建人", hidden = true)
    private String createBy;

    @TableField(fill = FieldFill.INSERT)
    @ApiModelProperty(value = "创建时间", hidden = true)
    private LocalDateTime createTime;

//    @TableField(fill = FieldFill.UPDATE)
    @ApiModelProperty(value = "修改人", hidden = true)
    private String updateBy;

    @TableField(fill = FieldFill.UPDATE)
    @ApiModelProperty(value = "修改时间", hidden = true)
    private LocalDateTime updateTime;

    @TableField(exist = false)
    @ApiModelProperty(value = "基本信息模板", hidden = true)
    private Set<Integer> patMouldIds;

    @TableField(exist = false)
    @ApiModelProperty(value = "项目映射", hidden = true)
    private List<String> itemIds;

    @TableField(exist = false)
    @ApiModelProperty(value = "量表分类名称")
    private String cName;

    @TableField(exist = false)
    @ApiModelProperty(value = "适用人群名称")
    private String uName;

    public interface recommend{

    }
}
